﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using MouseExtender.Helpers;
using MouseExtender.Plugins.Item;

namespace MouseExtender
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        internal static App CurrentApp
        {
            get
            {
                return (Current as App);
            }
        }

        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            //Logger.HandleCriticalError(e.Exception);
            //e.Handled = true;
        }


        private void InitializeApplication()
        {
#warning ignore all certificate error when accesing https resources
            //ServicePointManager.ServerCertificateValidationCallback = (obj, sert, chain, error) => { return true; };
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            WpfSingleInstance.Make("MouseExtender", this);
        }

        internal void Activate()
        {
            MessageBox.Show("next instance runned");
        }
    }

    public class GlobalServices
    {
        public static IModalService ModalService
        {
            get { return (IModalService)Application.Current.MainWindow; }
        }
    }

}
